1. Field of the Invention
The present invention relates to a method and apparatus for controlling HTTP (Hypertext Transfer Protocol) sockets. More particularly, the present invention relates to a method and apparatus for controlling persistent HTTP sockets.
2. Description of the Related Art
HTTP (Hypertext Transfer Protocol) is a communication protocol to transfer text-based information between a web server on the Internet and a web browser of a user. HTTP is the primary data communication protocol for the World Wide Web. In HTTP 1.1, all connections are considered persistent by default.
In HTTP, persistent sockets may be managed in the following ways. In the usage aspect, an unused persistent socket with the intended destination is readily used. In the maintenance aspect, persistent sockets may be handled differently according to platforms. For example, in SHP platform and Apple platform, the client maintains an unused socket in the socket pool until the server closes the socket. In Android platform, the client forcibly closes a persistent socket whose default time has expired.
Existing schemes for managing persistent sockets may have the following problems. Among a pool of persistent sockets, an empty socket is selected for utilization. However, the persistent socket pool may include a socket that is inefficiently managed, a socket that is connected but not usable, a socket that will be broken during use owing to socket options or default timeout. Use of such a socket may cause an error during page loading.
In addition, it may be difficult to efficiently manage persistent sockets. That is, reloading of the same page or loading of a connected sub-page may require creation of an additional socket. Socket creation may cause network delay and increase page loading time, thus having a negative effect on user experience.